package confidence.tools;

/**
 * 格式化道路
 */
public class FormatRoad {
    private static final String[] ROAD_NAME_APPENDIX_LIST = {
            "大街", "小街", "街",
            "大路", "小路", "路",
            "巷", "胡同",
            "大道", "小道", "道",
            "排", "条", "里", "段", "弄"
    };

    private static final String[] ROAD_NUM_APPENDIX_LIST = {
            "号院", "号院内", "号大院", "号小院",
            "号", "院", "弄", "支弄"
    };

    /**
     * 格式化路名
     * @param road_name
     * @return
     */
    public static String format_road_name(String road_name) {
        road_name = StringConvertUtil.formatText(road_name);
        return format_road(ROAD_NUM_APPENDIX_LIST, road_name);
    }

    /**
     * 格式化路号
     * @param road_name
     * @return
     */
    public static String format_road_num(String road_name) {
        road_name = StringConvertUtil.formatText(road_name);
        return format_road(ROAD_NAME_APPENDIX_LIST, road_name);
    }

    private static String format_road(String[] arr, String text) {
        return CommonUtil.rstrip_all(arr, text);
    }

}
